package com.chinacoal.microservice;


import com.chinacoal.microservice.fallback.ContractManagementClientFallback;
import com.chinacoal.microservice.pojo.CcmsSmartleasingAuditRecods;
import com.chinacoal.microservice.pojo.CcmsSmartleasingContract;
import com.chinacoal.microservice.util.QueryCriteria;
import com.chinacoal.microservice.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignAutoConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zhuliang
 * @version V1.0
 * @Description: 运维管理-合同管理
 * @date 2020-11-16 9：38
 */
@FeignClient(name = "${spring.application.name}",fallback = ContractManagementClientFallback.class,configuration = FeignAutoConfiguration.class)
@Api(tags = {"运维管理-合同管理"})
public interface ContractManagementClient {

    /**
     * @Description: 获取所有的合同信息（带分页）
     * @author zhuliang
     * @date 2020/11/17 9:21
     */
    @ApiOperation(value = "获取所有的合同信息（带分页）")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "queryCriteria", value = "查询条件", required = true, dataType = "QueryCriteria"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/contractManagement/getAllContract")
    public Result<List<CcmsSmartleasingContract>> getAllContract(@RequestBody QueryCriteria queryCriteria,
                                                                 @RequestHeader("token") String token);

    /**
     * @Description: 退租
     * @author zhuliang
     * @date 2020/11/17 11:18
     */
    @ApiOperation(value = "退租")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "contract", value = "合同实体类", required = true, dataType = "CcmsSmartleasingContract"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/contractManagement/surrender")
    public Result rentCancellation(@RequestBody CcmsSmartleasingContract contract,
                                   @RequestHeader("token") String token);

    /**
     * @Description: 根据合同id查询合同信息
     * @author zhuliang
     * @date 2020/11/17 13:56
     */
    @ApiOperation(value = "根据合同id查询合同信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "pkContractId", value = "合同id", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/contractManagement/getContractById/{pkContractId}")
    public Result<CcmsSmartleasingContract> getContractById(@PathVariable(value = "pkContractId") String pkContractId,
                                                            @RequestHeader("token") String token);

    /**
     * @Description: 修改合同信息和租户信息
     * @author zhuliang
     * @date 2020/11/17 14:40
     */
    @ApiOperation(value = "修改合同信息和租户信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "contract", value = "合同信息实体类", required = true, dataType = "CcmsSmartleasingContract"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PutMapping("smartleasing/contractManagement/updateContract")
    public Result updateContract(@RequestBody CcmsSmartleasingContract contract,
                                 @RequestHeader(value = "token") String token);

    /**
     * @Description: 审核
     * @author zhuliang
     * @date 2020/11/17 15:56
     */
    @ApiOperation(value = "审核")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "auditRecods", value = "审核信息类", required = true, dataType = "CcmsSmartleasingAuditRecods"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/contractManagement/reviewContract")
    public Result reviewContract(@RequestBody CcmsSmartleasingAuditRecods auditRecods,
                                 @RequestHeader("token") String token);

    /**
     * @Description: 根据合同id批量删除合同信息
     * @author zhuliang
     * @date 2020/11/17 16:50
     */
    @ApiOperation(value = "根据合同id批量删除合同信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "deleteId", value = "要删除的id字符串", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @DeleteMapping("smartleasing/contractManagement/deleteContract/{deleteId}")
    public Result deleteContract(@PathVariable(value = "deleteId",required = false) String deleteId,
                                 @RequestHeader("token") String token);

    /**
     * @Description: 条件查询合同信息（带分页）
     * @author zhuliang
     * @date 2020/11/18 10:37
     */
    @ApiOperation(value = "条件查询合同信息（带分页）")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "queryCriteria", value = "查询条件", required = true, dataType = "QueryCriteria"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/contractManagement/getContractByCondition")
    public Result<List<CcmsSmartleasingContract>> getContractByCondition(@RequestBody QueryCriteria queryCriteria,
                                                                         @RequestHeader("token") String token);

    /**
     * @Description: 添加合同信息
     * @author zhuliang
     * @date 2020/11/18 14:11
     */
    @ApiOperation(value = "添加合同信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "contract", value = "合同实体类", required = true, dataType = "CcmsSmartleasingContract"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/contractManagement/addContract")
    public Result addContract(@RequestBody CcmsSmartleasingContract contract,
                              @RequestHeader("token") String token);

}
